	#include <iostream>
    #include "httplib.h"
	void Hello(const httplib::Request &req, httplib::Response &rsp)
	{
		rsp.set_content("hello world!", "text/plain");//文本数据类型
		rsp.status = 200;//相应状态码
	}
	void Numbers(const httplib::Request &req, httplib::Response &rsp)
	{
		auto num = req.matches[1];//0中保存整体path，往后保存的是捕捉的数据:(\d+)
		rsp.set_content(num, "text/plain");//文本数据类型
		rsp.status = 200;//相应状态码
	}
	void Multipart(const httplib::Request &req, httplib::Response &rsp)
	{
		auto ret = req.has_file("file");//确定是否是文件上传
		if (ret == false){
			std::cout << "not file upload\n";
			rsp.status = 400;
			return;
		}
		const auto& file = req.get_file_value("file");//获取文件信息
		rsp.body.clear();
		rsp.body = file.filename;
		rsp.body += "\n";
		rsp.body += file.content;
		rsp.set_header("Content-Type", "text/plain");
		rsp.status = 200;
		return;
	}
	int main()
	{
		httplib::Server server;
		server.Get("/hi", Hello);
		server.Get(R"(/numbers/(\d+))", Numbers);// \d+等于%d
		server.Post("/multipart", Multipart);
		server.listen("0.0.0.0", 9090);
		return 0;
	}